export default class AddPropertyOnUseAbilityState {

    static config: { [id: string]: { addBaseDamage?: number } } = {}

    constructor() {


        let triggerHandle = CreateTrigger();
        TriggerRegisterAnyUnitEventBJ(triggerHandle, EVENT_PLAYER_UNIT_SPELL_EFFECT);
        TriggerAddAction(triggerHandle, this.action);
    }


    action(this: void) {
        let spellAbilityIdStr = id2string(GetSpellAbilityId());
        let cfgData = AddPropertyOnUseAbilityState.config[spellAbilityIdStr];
        if (cfgData) {
            let unit = GetTriggerUnit();
            if (cfgData.addBaseDamage) {
                SetUnitState(unit, ConvertUnitState(0x12), (GetUnitState(unit, ConvertUnitState(0x12)) + cfgData.addBaseDamage));
            }
        }
    }


}

